<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      // 将字符串中的不是字母和数字字符移除
      var str = "vv#$@@%.dd(df323)  ";
      var regex = /[0-9A-z]/g;
      var result = str.match(regex);

      console.log(result.join(""));

      // 将字符串中的字母和数字字符替换为0
      var regex1 = /[0-9A-z]/g;
      var result = str.replace(regex1, "0");
      console.log(result);
      // 检查文件名
      var reg = /\.jpg$|\.png$|\.gif$|\.webp$/i;
      var str = "a.png";
      var result = reg.test(str);
      console.log(result);
    </script>
  </head>
  <body></body>
</html>
